package com.sjl;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
@SpringBootApplication
@MapperScan("com.sjl.mapper")
public class App {

	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}

	@Bean // 开启mybatis plus分页插件
	public PaginationInterceptor paginationInterceptor() {
		return new PaginationInterceptor().setCountSqlParser(new JsqlParserCountOptimize(true));
	}

	/**
	 * 需要把 web 项目打成 war 包运行时需要重新此方法
	 */
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(App.class);
	}
}
